#include "VertBuffer.h"
VertBuffer::VertBuffer()
{
	pd3dDevice = NULL; 
	pVB = NULL; 
	matStack = NULL;
}
VertBuffer::VertBuffer(LPDIRECT3DDEVICE9 pd3dDeviceIn, LPDIRECT3DVERTEXBUFFER9 pVBIn, LPD3DXMATRIXSTACK matStackIn)
{
	pd3dDevice = pd3dDeviceIn; 
	pVB = pVBIn; 
	matStack = matStackIn;
}
VertBuffer::VertBuffer(const VertBuffer& rhs)
{
	pd3dDevice = rhs.pd3dDevice; 
	pVB = rhs.pVB; 
	matStack = rhs.matStack;
}
VertBuffer& VertBuffer::operator=(const VertBuffer& rhs)
{
	pd3dDevice = rhs.pd3dDevice; 
	pVB = rhs.pVB; 
	matStack = rhs.matStack;
	return *this;
}
VertBuffer::~VertBuffer(void)
{
}

HRESULT VertBuffer::AddVerts(LPD3DXMESH pGeomMesh, D3DMATERIAL9 mtrl)
{
	pd3dDevice->SetTransform( D3DTS_WORLD, matStack->GetTop());
	D3DXMATRIX Test = (*(matStack->GetTop()));
	pd3dDevice->SetMaterial(&mtrl);
	D3DXComputeTangentFrame(pGeomMesh,D3DXTANGENT_CALCULATE_NORMALS);
	pGeomMesh->DrawSubset(0);
	return S_OK;
}

 